package es.tikitaka.actions;

import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.core.Conversation;
import org.jboss.seam.log.Log;

/**
 * 
 * @author Saúl Domínguez
 * @since 2010
 * @category PFC
 */

@Name("conversationLogger")
public class ConversationLogger {
	@Logger
	private Log log;

	@Observer("org.jboss.seam.beginConversation")
	public void logConversationBegin() {
		Conversation currentConversation = Conversation.instance();

		log.info("Beginning conversation: #0, Parent Id: #1",
				currentConversation.getId(), currentConversation.getParentId());
	}

	@Observer("org.jboss.seam.endConversation")
	public void logConversationEnd() {
		Conversation currentConversation = Conversation.instance();

		log.info("Ending conversation: #0, Parent Id: #1", currentConversation
				.getId(), currentConversation.getParentId());
	}
}